#include <stdio.h>
#include <stdlib.h> 
#include <time.h>
int main () {
    srand((unsigned)time(NULL));
    int a = rand()%100+1;
    int b = 0;
    printf("请猜出一个数字\n");
    scanf("%d",&b);
    for(int i = 0; i < 100; i++){
        if(b == a){
            printf("恭喜你在第%d次猜中了数字%d\n",i,a);
            break;
        }
        else if( b > a){
            printf("你猜的数字大了,请重新输入\n");
            scanf("%d",&b);
        }
        else{
            printf("你猜的数字小了,请重新输入\n");
            scanf("%d",&b);
        }
    }
}